﻿using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using PCE.Mvc.Model;

namespace PCE.Mvc.Controllers
{
	public class MenuController : Controller
	{
		public ActionResult List()
		{
			var data = new List<MenuItem>
			{
				new MenuItem
				{
					Name = "Главная", 
					RouteValues = new RouteValueDictionary(new { controller = "Home", action = "Index" })
				},
				new MenuItem
				{
					Name = "Описание системы", 
					RouteValues = new RouteValueDictionary(new { controller = "Home", action = "About" })
				}
			};

			if (User.Identity.IsAuthenticated)
			{
				data.Add(new MenuItem { Name = "Личные данные", RouteValues = new RouteValueDictionary(new { controller = "Profile", action = "Edit" } )});
				data.Add(new MenuItem { Name = "Мои заявки", RouteValues = new RouteValueDictionary(new { controller = "Tender", action = "List" } )});
				data.Add(new MenuItem { Name = "Предложения", RouteValues = new RouteValueDictionary(new { controller = "Offer", action = "List" } )});
				data.Add(new MenuItem { Name = "Мои предложения", RouteValues = new RouteValueDictionary(new { controller = "OfferExec", action = "List" }) });
				data.Add(new MenuItem { Name = "Отклики", RouteValues = new RouteValueDictionary(new { controller = "OrderExec", action = "List" }) });
				data.Add(new MenuItem { Name = "Выйти", RouteValues = new RouteValueDictionary(new { controller = "Login", action = "LogOut" } )});
			}
			else
			{
				data.Add(new MenuItem { Name = "Войти", RouteValues = new RouteValueDictionary(new { controller = "Login", action = "LogOn" } )});
				data.Add(new MenuItem { Name = "Регистрация", RouteValues = new RouteValueDictionary(new { controller = "Register", action = "Create" } )});
			}

			return View(data);
		}
	}
}